<template>
  <div>
    <p :class="color">This should be red</p>
    <div class="box">
      <button @click="handClick">改变样式</button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'page-day26',
  data() {
    return {
      color: this.classNames.red
    }
  },
  methods: {
    handClick() {
      this.color =
        this.color == this.classNames.red
          ? this.classNames.green
          : this.classNames.red
    }
  }
}
</script>
<style module="classNames">
.red {
  color: red;
}
.green {
  color: green;
}
</style>
<style lang="scss" scoped>
.box {
  font-size: 20px;
}
</style>
